package com.dubito.fresco

import android.net.Uri
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.view.SimpleDraweeView
import com.facebook.imagepipeline.request.ImageRequestBuilder


class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val img = "http://pic.netbian.com/uploads/allimg/200121/230803-157961928349a7.jpg"
        val draweeView =
            findViewById<SimpleDraweeView>(R.id.imageView)
        val build = ImageRequestBuilder.newBuilderWithSource(Uri.parse(img))
            .setProgressiveRenderingEnabled(true).build()
        val controller = Fresco.newDraweeControllerBuilder().setImageRequest(build).build()

        draweeView.controller = controller
    }
}
